import requests
import json

# url = 'https://static-data.eol.cn/www/2.0/samescore3/2020/713.json'
# response = requests.get(url)
# data = json.loads(response.text)
# with open('分析.json', 'w', encoding='utf-8') as f:
#     json.dump(data, f, indent=4, ensure_ascii=False)
#
#
# url = 'https://static-gkcx.eol.cn/www/2.0/json/samescore/9549/list.json'
# response = requests.get(url)
# data = json.loads(response.text)
# with open('分析_1.json', 'w', encoding='utf-8') as f:
#     json.dump(data, f, indent=4, ensure_ascii=False)

# url = 'https://static-data.eol.cn/www/2.0/samescore3/2020/750.json'
# response = requests.get(url)
# data = json.loads(response.text)
# with open('750.json', 'w', encoding='utf-8') as f:
#     json.dump(data, f, indent=4, ensure_ascii=False)

import requests
from lxml import etree
from urllib.parse import quote
import json


if __name__ == '__main__':
    url = "https://gkcx.eol.cn/quanzhidao?localProvince=12&year=2020"

    lua = '''function main(splash, args)
      splash.private_mode_enabled = false
      assert(splash:go("''' + url + '''"))
      assert(splash:wait(0.5))
      splash:set_user_agent("Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36")
      return {
        html = splash:html(),
      }
    end'''

    response = requests.get("http://localhost:8888/execute?lua_source=" + quote(lua))
    html_text = response.text
    print(html_text)